package top.onedream.buildsmallsoftware.cfg.exception

import top.onedream.buildsmallsoftware.enums.ExceptionEnum

data class CustomException(
    var code: Int? = 500,
    override var message: String? = "server error",
    var data: Any?
) : RuntimeException() {

    constructor(
        customExceptionEnum: ExceptionEnum
    ) : this(
        customExceptionEnum.code,
        customExceptionEnum.message
    )

    constructor(
        customExceptionEnum: ExceptionEnum,
        data: Any?
    ) : this(
        customExceptionEnum.code,
        customExceptionEnum.message,
        data
    )

    constructor(
        code: Int? = 500,
        message: String? = "server error"
    ) : this(
        code,
        message,
        null
    )
}
